﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using YiLe.DAL.Dao;
using YiLe.Model.Domain;
using NHibernate;
using NHibernate.Criterion;

namespace YiLe.DAL.NHibernate
{
    public class PermissionDaoHibernate:BaseHibernate<Permission, int>, PermissionDao
    {
        public IList<Permission> Search(Permission permission)
        {
            ICriteria criteria = Session.CreateCriteria<Permission>();
            criteria.Add(Restrictions.Like("PermissionName", "%" + permission.PermissionName + "%"));
            criteria.AddOrder(new Order("PermissionID", true));
            return criteria.List<Permission>();
        }
    }
}
